import multiprocessing
from time import sleep
from multiprocessing import Process

from data import processes
from handler import monitor, h2, run


def main():
    p3 = Process(target=run, args=("p3",))
    p3.start()
    monitor(p3, run)
    processes["case100"] = p3
    num = 0
    while True:
        print(
            f"{multiprocessing.active_children()=}, count={len(multiprocessing.active_children())}\n")
        print(f"{processes=}\n")
        sleep(4)
        if num == 4:
            h2(processes["case100"])
        if num == 8:
            h2(processes["case100"])
        if num == 12:
            h2(processes["case100"])
        num += 2


if __name__ == '__main__':
    main()
